package cn.chendd.task.examples;

import cn.chendd.task.TaskDescription;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 简单定时任务
 *
 * @author chendd
 * @date 2023/1/28 16:48
 */
@EnableScheduling
@Component
public class SchedulingJob {

    @Scheduled(cron = "0/10 * 8-23 * * ?")
    public void sayHello() {
        System.out.println("SchedulingJob.hello=" + LocalDateTime.now().toString());
    }

    @Scheduled(cron = "0/10 * 8-23 * * ?")
    @TaskDescription("听说今天是春节后的第一个工作日")
    public void helloChendd() {
        System.out.println("SchedulingJob.helloChendd=" + LocalDateTime.now().toString());
    }

}
